<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCouponTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('coupon', function (Blueprint $table) {
            $table->increments('id')->comment('卡卷ID');
            $table->string('name',120)->comment('优惠劵名称');
            $table->integer('send_num')->unsigned()->default(0)->comment('总领取数');
            $table->integer('use_num')->unsigned()->default(0)->comment('已使用次数');
            $table->integer('per_user_num')->unsigned()->default(0)->comment('每人领卷张数限制');
            $table->decimal('min_price', 10, 2)->default(0)->comment('最小使用金额');
            $table->decimal('max_value', 10, 2)->default(0)->comment('优惠劵金额');
            $table->integer('goods_id')->unsigned()->default(0)->comment('商品ID');
            $table->integer('scope_type')->unsigned()->default(1)->comment('使用范围类型:1:满减类型,2:赠送类型,3:直接赠送小妖币');
            $table->timestamps();

        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('coupon');
    }
}
